package com.zjw.touchscreen.bluetooth;

import android.annotation.SuppressLint;
import android.os.Build;
import androidx.annotation.RequiresApi;

@RequiresApi(api = Build.VERSION_CODES.P)
@SuppressLint("MissingPermission")
public class MouseHelper {

    public @interface MouseButton {
        int LEFT = 0;
        int RIGHT = 1;
        int MIDDLE = 2;
    }

    public static boolean sendData(boolean left, boolean right, boolean middle, int x, int y, int wheel) {
        if (BluetoothUtils.bluetoothHidDevice != null && BluetoothUtils.isHidDeviceConnected) {
            return BluetoothUtils.bluetoothHidDevice.sendReport(BluetoothUtils.bluetoothDevice, Constants.ID_MOUSE, MouseReport.getReport(left, right, middle, x, y, wheel));
        }
        return false;
    }

    public static boolean sendKeyUp() {
        if (BluetoothUtils.bluetoothHidDevice != null && BluetoothUtils.isHidDeviceConnected) {
            return BluetoothUtils.bluetoothHidDevice.sendReport(BluetoothUtils.bluetoothDevice, Constants.ID_MOUSE, MouseReport.getReport(false, false, false, 0, 0, 0));
        }
        return false;
    }
}
